/**
 * 
 */
package com.arx.script.flyweight;

import com.arx.interactive.InteractiveObject;

/**
 * @author Donald
 */
public final class ScriptTimer {
	private ScriptObject		es;
	private boolean				exist;
	private short				flags;
	private InteractiveObject	io;
	private long				longinfo;
	private long				msecs;
	private byte[]				name;
	private long				namelength;
	private int				pos;
	private long				tim;
	private long				times;
	/**
	 * Assigns a specific flag, if it wasn't already set.
	 * @param flag the flag to be set
	 */
	public void assignFlag(final int flag) {
		flags |= flag;
	}
	/** Resets the {@link ScriptTimer}. */
	public void reset() {
		es = null;
		exist = false;
		io = null;
		longinfo = 0;
		msecs = 0;
		name = null;
		namelength = 0;
		pos = 0;
		tim = 0;
		times = 0;
		flags = 0;
	}
	/** Clears all flags. */
	public void clearFlags() {
		flags = 0;
	}
	public boolean exists() {
		return exist;
	}
	public ScriptObject getEs() {
		return es;
	}
	public InteractiveObject getIo() {
		return io;
	}
	public long getLonginfo() {
		return longinfo;
	}
	public long getMsecs() {
		return msecs;
	}
	public byte[] getNameAsBytes() {
		return name;
	}
	public String getNameAsString() {
		return new String(name);
	}
	public long getNamelength() {
		return namelength;
	}
	public int getPos() {
		return pos;
	}
	public long getTim() {
		return tim;
	}
	public long getTimes() {
		return times;
	}
	/**
	 * Determines if the {@link ScriptTimer} has a specific flag set.
	 * @param flag the flag
	 * @return true if the object has the flag set; false otherwise
	 */
	public boolean hasFlag(final int flag) {
		return (flags & flag) == flag;
	}
	/**
	 * Removes a specific flag if it was set.
	 * @param flag the flag to be removed
	 */
	public void removeFlag(final int flag) {
		flags &= ~flag;
	}
	public void setEs(final ScriptObject es) {
		this.es = es;
	}
	public void setExist(final boolean val) {
		exist = val;
	}
	public void setIo(final InteractiveObject io) {
		this.io = io;
	}
	public void setLonginfo(final long longinfo) {
		this.longinfo = longinfo;
	}
	public void setMsecs(final long msecs) {
		this.msecs = msecs;
	}
	public void setName(final byte[] val) {
		name = val;
	}
	public void setNamelength(final long namelength) {
		this.namelength = namelength;
	}

	public void setPos(final int val) {
		this.pos = val;
	}
	public void setTim(final long tim) {
		this.tim = tim;
	}
	public void setTimes(final long times) {
		this.times = times;
	}
}
